package com.ruoyi.cderp.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.cderp.mapper.OnlineExcelMapper;
import com.ruoyi.cderp.domain.OnlineExcel;
import com.ruoyi.cderp.service.IOnlineExcelService;

import static com.ruoyi.common.utils.SecurityUtils.getLoginUser;

/**
 * 在线ExcelService业务层处理
 *
 * @author ruoyi
 * @date 2025-02-18
 */
@Service
public class OnlineExcelServiceImpl implements IOnlineExcelService
{
    @Autowired
    private OnlineExcelMapper onlineExcelMapper;

    /**
     * 查询在线Excel
     *
     * @param id 在线Excel主键
     * @return 在线Excel
     */
    @Override
    public OnlineExcel selectOnlineExcelById(String id)
    {
        return onlineExcelMapper.selectOnlineExcelById(id);
    }

    /**
     * 查询在线Excel列表
     *
     * @param onlineExcel 在线Excel
     * @return 在线Excel
     */
    @Override
    public List<OnlineExcel> selectOnlineExcelList(OnlineExcel onlineExcel)
    {
        return onlineExcelMapper.selectOnlineExcelList(onlineExcel);
    }

    /**
     * 新增在线Excel
     *
     * @param onlineExcel 在线Excel
     * @return 结果
     */
    @Override
    public int insertOnlineExcel(OnlineExcel onlineExcel)
    {
        onlineExcel.setCreateTime(DateUtils.getNowDate());

        //角色
        onlineExcel.setCreateBy("系统管理员");
        //编号
        onlineExcel.setCreateById("1");

        return onlineExcelMapper.insertOnlineExcel(onlineExcel);
    }

    /**
     * 修改在线Excel
     *
     * @param onlineExcel 在线Excel
     * @return 结果
     */
    @Override
    public int updateOnlineExcel(OnlineExcel onlineExcel)
    {
        onlineExcel.setUpdateTime(DateUtils.getNowDate());

        //角色
        onlineExcel.setUpdateBy("系统管理员");
        //编号
        onlineExcel.setUpdateById("1");

        return onlineExcelMapper.updateOnlineExcel(onlineExcel);
    }

    /**
     * 批量删除在线Excel
     *
     * @param ids 需要删除的在线Excel主键
     * @return 结果
     */
    @Override
    public int deleteOnlineExcelByIds(String[] ids)
    {
        return onlineExcelMapper.deleteOnlineExcelByIds(ids);
    }

    /**
     * 删除在线Excel信息
     *
     * @param id 在线Excel主键
     * @return 结果
     */
    @Override
    public int deleteOnlineExcelById(String id)
    {
        return onlineExcelMapper.deleteOnlineExcelById(id);
    }
}
